package com.birdy.ws.code;


/**
 * @author birdy
 * @date 2022/4/7 10:46 AM
 */
public enum MessageCode {
    /**
     * message消息类型
     * user_login: 新用户加入
     *
     */
    USER_LOGIN(10001, "new user"),
    USER_LIST(10002, "user list"),
    ROOM_CREATE(10003, "room create"),
    ROOM_CREATE_FAILED(10004, "room create failed"),
    ROOM_SETTING(10005, "room setting"),
    ROOM_SETTING_FAILED(10006, "room setting failed"),
    USER_LOGOUT(10886, "user logout"),
    GAME_START(20001, "game start");

    private int code;
    private String message;
    private MessageCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {  // 直接将数据以JSON的形式返回
        return "{\"code\":" + this.code + ",\"message\":" + this.message + "}";
    }
}
